package cn.kgm.abstractFactory;

import cn.kgm.abstractFactory.color.Blue;
import cn.kgm.abstractFactory.color.Color;
import cn.kgm.abstractFactory.color.Grenn;
import cn.kgm.abstractFactory.color.Red;
import cn.kgm.abstractFactory.shape.Shape;
import cn.kgm.enums.ColorEnums;

public class ColorFactory extends AbstractFactory {

    @Override
    public Color getColor(String color) {
        Color colorBean = null;
        try {
            switch (ColorEnums.getByColor(color)) {
                case RED:
                    colorBean = new Red();
                    break;
                case BLUE:
                    colorBean = new Blue();
                    break;
                case GRENN:
                    colorBean = new Grenn();
                    break;
                default:
                    return colorBean;
            }
            return colorBean;
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Shape getShape(String type) {
        return null;
    }
}
